<template>
  <div class="login-page">
    <!-- 背景装饰 -->
    <div class="bg-decoration">
      <div class="bg-circle circle-1"></div>
      <div class="bg-circle circle-2"></div>
      <div class="bg-circle circle-3"></div>
      <div class="grid-pattern"></div>
    </div>

    <!-- 登录主容器 -->
    <div class="login-container">
      <!-- 左侧品牌区 -->
      <div class="brand-section">
        <div class="brand-logo">
          <i class="fa fa-brain"></i>
        </div>
        <h1 class="brand-title">智能AI助手</h1>
        <p class="brand-desc">
          登录账户，体验AI驱动的智能服务与个性化解决方案
        </p>
        <div class="decor-elements">
          <div class="decor decor-1"></div>
          <div class="decor decor-2"></div>
          <div class="decor decor-3"></div>
        </div>
      </div>

      <!-- 右侧表单区：路由视图，显示不同表单 -->
      <router-view class="form-section"></router-view>
    </div>
  </div>
</template>

<script setup>
  import { onMounted } from 'vue';
  onMounted(() => {
    localStorage.removeItem('token');
  })
</script>

<style lang="scss" scoped>
/* 保留原有背景、布局样式，确保视觉一致性 */
.login-page {
  min-height: 100vh;
  width: 100%;
  box-sizing: border-box;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f9fafb;
  position: relative;
  overflow: hidden;
}

.bg-decoration {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;

  .bg-circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.15;
  }

  .circle-1 {
    width: 600px;
    height: 600px;
    background: #165dff;
    top: -200px;
    right: -100px;
  }

  .circle-2 {
    width: 500px;
    height: 500px;
    background: #7b61ff;
    bottom: -150px;
    left: -100px;
  }

  .circle-3 {
    width: 400px;
    height: 400px;
    background: #36bffa;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }

  .grid-pattern {
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23165DFF' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  }
}
$divHeight: 800px;
.login-container {
  min-height: $divHeight;
  max-width: 1000px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-radius: 20px;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.08);
  background-color: #fff;
  position: relative;
  z-index: 1;
  overflow: hidden;
  @media (max-width: 768px) {
    grid-template-columns: 1fr;
    box-shadow: none;
    background-color: transparent;
  }
}

.brand-section {
  min-height: $divHeight;
  padding: 60px;
  background: linear-gradient(135deg, #165dff 0%, #36bffa 50%, #7b61ff 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;

  @media (max-width: 768px) {
    display: none;
  }

  .brand-logo {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    background-color: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;

    i {
      font-size: 36px;
    }
  }

  .brand-title {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 16px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  }

  .brand-desc {
    font-size: 16px;
    opacity: 0.9;
    line-height: 1.5;
    max-width: 320px;
  }

  .decor-elements {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 200px;

    .decor {
      position: absolute;
      border-radius: 50%;
      border: 2px solid rgba(255, 255, 255, 0.1);
      animation: float 6s ease-in-out infinite;
    }

    .decor-1 {
      width: 80px;
      height: 80px;
      bottom: 40px;
      left: 60px;
    }

    .decor-2 {
      width: 120px;
      height: 120px;
      bottom: -20px;
      left: 180px;
      animation-delay: 1s;
    }

    .decor-3 {
      width: 50px;
      height: 50px;
      bottom: 80px;
      left: 280px;
      animation-delay: 2s;
    }
  }
}

.form-section {
  min-height: $divHeight;
  padding: 60px;
  display: flex;
  align-items: center;
  justify-content: center;

  @media (max-width: 768px) {
    padding: 20px;
  }
}
</style>